<form class="form-horizontal" name="caseForm" ng-submit="$dialog.save(caseForm);" novalidate>
    <div class="modal-header bg-primary">
        <h3 class="modal-title">Update case(s)</h3>
    </div>

    <div class="modal-body">
        <p class="mb-xs">
            Select the changes you want to apply to the selected cases. (<a href ng-click="$dialog.toggleAll()">{{$dialog.state.all ? 'Uncheck All' : 'Check all'}}</a>)
        </p>

        <div class="form-group">
            <label class="col-md-3 control-label">TLP <input class="ml-xxs" type="checkbox" ng-model="$dialog.state.enableTlp"></label>
            <div class="col-md-9">
                <p class="form-control-static">
                    <a href ng-click="$dialog.activeTlp = 'active'">
                        <tlp value="$dialog.params.tlp" format="$dialog.activeTlp" on-update="$dialog.toggleTlp(newValue)" class="form-control-static"></tlp>
                    </a>
                </p>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-3 control-label">PAP <input class="ml-xxs" type="checkbox" ng-model="$dialog.state.enablePap"></label>
            <div class="col-md-9">
                <p class="form-control-static">
                    <a href ng-click="$dialog.activePap = 'active'">
                        <tlp value="$dialog.params.pap" format="$dialog.activePap" namespace="PAP" on-update="$dialog.togglePap(newValue)" class="form-control-static"></tlp>
                    </a>
                </p>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-3 control-label">Severity <input class="ml-xxs" type="checkbox" ng-model="$dialog.state.enableSeverity"></label>
            <div class="col-md-9">
                <p class="form-control-static">
                    <a href ng-click="$dialog.activeSeverity = true">
                        <severity active="$dialog.activeSeverity" on-update="$dialog.toggleSeverity(newValue)" value="$dialog.params.severity"></severity>
                    </a>
                </p>
            </div>
        </div>

        <div class="form-group" ng-class="{ 'has-error' : caseForm.addTags.$invalid && !caseForm.addTagsInput.$pristine }">
            <label class="col-md-3 control-label">Add Tags <input class="ml-xxs" type="checkbox" ng-model="$dialog.state.enableAddTags"></label>
            <div class="col-md-9">
                <input type="hidden" name="addTags" ng-model="$dialog.params.addTagNames" ng-required="$dialog.state.enableAddTags"/>

                <div class="input-group">
                    <tags-input name="addTagsInput" ng-model="$dialog.params.addTags" class="ti-input-sm ti-tag-selector"
                        placeholder="Add tags" replace-spaces-with-dashes="false" min-length="2"
                        on-tag-added="$dialog.toggleAddTags()" template="views/directives/tag-input-item.html">
                        <auto-complete min-length="3" debounce-delay="400" source="$dialog.getTags($query)"></auto-complete>
                    </tags-input>

                    <span class="input-group-btn vtop">
                        <button type="button" class="btn btn-block btn-sm btn-primary" ng-click="$dialog.fromTagLibrary('add')" uib-tooltip="Add tag from library" tooltip-placement="left">
                            <span class="fa fa-plus"></span>
                        </button>
                    </span>
                </div>

            </div>
        </div>

        <div class="form-group" ng-class="{ 'has-error' : caseForm.removeTags.$invalid && !caseForm.removeTagsInput.$pristine }">
            <label class="col-md-3 control-label">Remove Tags <input class="ml-xxs" type="checkbox" ng-model="$dialog.state.enableRemoveTags"></label>
            <div class="col-md-9">
                <input type="hidden" name="removeTags" ng-model="$dialog.params.removeTagNames" ng-required="$dialog.state.enableRemoveTags"/>
                <div class="input-group">
                    <tags-input name="removeTagsInput" ng-model="$dialog.params.removeTags" class="ti-input-sm ti-tag-selector"
                        placeholder="Remove tags" replace-spaces-with-dashes="false" min-length="2"
                        on-tag-added="$dialog.toggleRemoveTags()" template="views/directives/tag-input-item.html">
                        <auto-complete min-length="3" debounce-delay="400" source="$dialog.getTags($query)"></auto-complete>
                    </tags-input>

                    <span class="input-group-btn vtop">
                        <button type="button" class="btn btn-block btn-sm btn-primary" ng-click="$dialog.fromTagLibrary('remove')" uib-tooltip="Add tag from library" tooltip-placement="left">
                            <span class="fa fa-plus"></span>
                        </button>
                    </span>
                </div>
            </div>
        </div>
    </div>



    <div class="modal-footer text-left">
        <button class="btn btn-default" ng-click="$dialog.cancel()" type="button">Cancel</button>
        <button class="btn btn-primary pull-right" ng-disabled="caseForm.$invalid" type="submit">Update case(s)</button>
    </div>
</form>
